package com.example.treasure_back.utils;

import java.util.Random;

public class VerifyCode {

    private static final String ALLCHAR = "0123456789";
    // length：随机位数
    public static String generateString(int length) {
        StringBuffer sb = new StringBuffer();
        Random random = new Random();
        for (int i = 0; i < length; i++) {
            sb.append(ALLCHAR.charAt(random.nextInt(ALLCHAR.length())));
        }
        return sb.toString();
    }
}
